<template>
	<view class="page-container">
		<!-- <u-picker
			:show="pickerShow"
			ref="uPicker"
			:columns="columns"
			keyName="name"
			@confirm="pickerConfirm"
			@change="pickerChangeHandler"
			@cancel="pickerHide"
			:closeOnClickOverlay="true"
			:immediateChange="true"
			:defaultIndex="defaultPickerIndex"
		></u-picker> -->

		<!-- <view class="inputBox" @click="pickerOpen">
			<view class="need">*</view>
			<view class="tit">省：</view>
			<input class="input" type="text" placeholder="请选择" :value="form.g1Salesarea" />
			<u-icon class="icon-arrow-b" name="arrow-down-fill" labelColor="#D4D4D4" labelSize="3"></u-icon>
		</view> -->

		<view class="block">
			<!-- <view class="cap">微网点基础信息</view> -->

			<view class="inputBox">
				<view class="tit">微网点名称</view>
				<view class="input"></view>
				<input class="inpCenter iW120" type="text" placeholder="路名" v-model="form.siteAddName" />
				<view class="inpLine">|</view>
				<input class="inpCenter iW120" type="text" placeholder="市场名" v-model="form.siteScName" />
				<view class="inpLine">|</view>
				<input class="inpCenter iW120" type="text" placeholder="摊位号" v-model="form.siteTwName" />
			</view>

			<view class="inputBox">
				<view class="tit">负责人姓名</view>
				<input class="input" type="text" placeholder="输入姓名" v-model="form.siteMemName" />
				<view class="inpLine lineCol1">|</view>
				<uni-icons type="camera-filled" size="24" color="#007AFF" @click="chooseImg"></uni-icons>
			</view>

			<view class="inputBox">
				<view class="tit">负责人身份证号</view>
				<input class="input" type="text" placeholder="输入身份证号" v-model="form.siteMemIdcard" />
			</view>

			<view class="inputBox">
				<view class="tit">位置</view>
				<view class="input">
					{{form.siteAddress||'请选择定位'}}
					<!-- <input class="input" type="text" placeholder="定位定 || 请选择定位" v-model="form.address" />
					<view class="inputCover"></view> -->
				</view>
				<view class="inpLine lineCol1">|</view>
				<uni-icons type="location-filled" size="24" color="#007AFF" @click="chooseLocation"></uni-icons>
			</view>

			<view class="inputBox comListBox">
				<view class="tit">门头照片</view>
				<view class="comList">
					<!-- <view class="imgItem"><image class="img" :src="identity[0].url" mode="widthFix"></image></view> -->
					<view class="imgItem" v-for="(item, index) in shopImgs">
						<image class="img" :src="item.url" mode="aspectFit" @click="imgPreview(index)"></image>
						<u-icon name="minus-circle-fill" @click="deleteImg('shopImgs', index, item)" class="picBoxRemove"></u-icon>
					</view>
					<view class="imgItem" @click="chooseMulImg('shopMangerShopImgs')"><image class="img" src="../../static/shopManger/addImg.png" mode="aspectFit"></image></view>
				</view>
			</view>

			<view class="inputBox comListBox">
				<view class="tit">样品照片</view>
				<view class="comList">
					<view class="imgItem" v-for="(item, index) in sampleImgs">
						<image class="img" :src="item.url" mode="aspectFit" @click="imgPreview(index)"></image>
						<u-icon name="minus-circle-fill" @click="deleteImg('sampleImgs', index, item)" class="picBoxRemove"></u-icon>
					</view>
					<view class="imgItem" @click="chooseMulImg('shopMangerSampleImgs')"><image class="img" src="../../static/shopManger/addImg.png" mode="widthFix"></image></view>
				</view>
			</view>

			<view class="inputBox">
				<view class="tit">拿货来源</view>
				<view class="input"></view>
				<u-radio-group v-model="form.siteFrom">
					<u-radio <u-radio shape="circle" v-for="(item, index) in goodsSourceArr" :key="index" :label="item.name" :name="item.name" @change="radioChange">
						{{ item.name }}
					</u-radio>
				</u-radio-group>
			</view>

			<view class="inputBox" v-if="showSelStore">
				<view class="tit">选择店面</view>
				<view class="input storeName" @click="popupShow">{{form.siteDeptName||'请选择店面'}}</view>
				<view>> </view>
			</view>

			<view class="inputBox comListBox">
				<view class="tit">审批流程</view>
				<view class="comList">
					<view class="applyItem">
						<image class="auditor" src="../../static/shopManger/auditor.png" mode="widthFix"></image>
						<view class="tit">{{form.siteApply1Name}}</view>
						<view class="line"></view>
					</view>
					<view class="applyItem">
						<image class="auditor" src="../../static/shopManger/auditor.png" mode="widthFix"></image>
						<view class="tit">{{form.siteApply2Name}}</view>
						<view class="line"></view>
					</view>
				</view>
			</view>
		</view>

		<br />
		<br />
		<br />
		<view class="goAddBtnBox"><view class="goAddBtn" @click="clickSubmit">提交</view></view>
		
		
		<!-- 弹窗 选择店面 -->
		<u-popup mode="center" v-model="popShow" border-radius="10" width="70%" @close="popClose" @open="popOpen" class="popBox">
			
			<!-- <view class="search-box">
				<u-search placeholder="请输入关键词进行搜索" v-model="storeQuery.value" :clearabled="true" actionText="搜索" @custom="search" @search="search" @clear="clearSearch"
				></u-search>
			</view> -->
			
			<view class="popCap"> 选择店面 </view>
			
			<view class="noInfo" v-if="storeList.length == 0">
				暂无相关店面
			</view>
			
			<scroll-view class="scroll-y" :scroll-top="scrollTop" scroll-y="true" @scrolltolower="scrolltolower">
				<view class="card cardPop">
					<view class="content">
							<view class="client-list">
								<view class="client-item" :class="form.siteDeptCode == item.id?'on':''" v-for="item in storeList" :key="item.storeTypeCode" @click="selStore(item)">
									<view class="block">
										<view class="info">
											<span class="name">{{item.storeName}}</span>
										</view>
									</view>
								</view>
							</view>
					</view>
				</view>
			</scroll-view>
			
		</u-popup>
		
		<u-toast ref="uToast" />
		<u-line-progress v-if="showULineProgress" :height="28" :striped="true" :percent="currentProgress" :striped-active="true"></u-line-progress>
		
	</view>
</template>
E:\shan\hif\hif\hn-mobile-xd-uni\uview-ui\libs\function
<script>
import CONFIG from '../../common/config.js'
import utils from '../../common/utils.js'
import test from '../../uview-ui/libs/function/test.js'
import { siteFrom, xdStoreList, addSite, siteSp, getIdCardInfo } from '../../common/api/shopManger.js'
import { getPreId, getFileList, deleteFile, getNearByStores, editStoreInfo, saveXDInfo, MemberInfoByMemCode } from '../../common/service.js'
export default {
	name: 'shopMangerAdd',
	data() {
		return {
			preId: '', // 新增时，上传多附件，需要先获取预约的记录id
			scrollTop: 0,
			goodsSourceArr: [{ name: '公司直发' }, { name: '其他店面' }],
			popShow: false,
			storeHasMore:true,
			storeQuery:{
				'value':'',
				'rp03name':'',
				'brand':'',
				'pageNum':1,
				'pageSize':9,
				'memCode': CONFIG.user.id,
				'memcode': CONFIG.user.id
			},
			form: {
				id:'',//主键id
				createBy: "",
				updateBy: "",
				siteCreateName:'',//创建人姓名
				siteStatus:'',//营业状态 siteStatus 支持单个状态搜索
				siteAddName:'',//路名
				siteScName:'',//市场名
				siteTwName:'',//摊位号
				siteMemName:'',//负责人姓名
				siteMemIdcard:'',//负责人身份证号
				siteLongitude:'',//经度 
				siteLatitude:'',//纬度
				siteAddress:'',//位置地址
				siteFrom:'',//拿货来源
				siteDeptCode:'',//绑定店面code
				siteDeptName:'',//绑定店面名称
				siteApply1Code:'',//一级审批人code
				siteApply1Name:'',//一级审批人name
				siteApply2Code:'',//二级审批人code
				siteApply2Name:'',//二级审批人name
				
				rp02:'',//一级销区code
				rp02name:'',//一级销区name
				rp03:'',//二级销区code
				rp03name:'',//二级销区name
				rp05:'',//品牌部code
				rp05name:'',//品牌部name
			},
			memCode: CONFIG.user.id,
			pickerShow: false,
			columns: [[], [], []],
			defaultPickerIndex: [0, 0, 0],
			showULineProgress: false,
			currentProgress: 0,
			identity: [], // 身份图片
			shopImgs: [], // 店面图片
			sampleImgs: [] ,// 样品图片，
			storeList:[],
			storeStatus:[],
			storeSptype:[],
			cardInfo:{},
			showSelStore:true, // 是否显示【选择门店】选项
		}
	},
	onLoad(e) {
		this.LOGINACTION()

		this.memCode = CONFIG.user.id
		
		// 初始化 拿货来源 
		this.goodsSourceArr = siteFrom()
		// 选择门店弹窗入口是否显示
		// this.radioChange(this.goodsSourceArr[0].name)
	},
	created() {
		
		if (!this.preId) {
			this.getPreIdFn()
		}
		
		
		// ？只有箭牌卫浴的开入口使用，审批人是hn036967张巍，hn031918李新鑫
		this.form.siteApply1Code='hn036967'//一级审批人code
		this.form.siteApply1Name='张巍'//一级审批人name
		this.form.siteApply2Code='hn031918'//二级审批人code
		this.form.siteApply2Name='李新鑫'//二级审批人name
		
		this.getMemberInfoByMemCode(this.memCode, res=>{
			this.form.rp02 = res.data.data[0].RP02
			this.form.rp02name = res.data.data[0].RP02NAME
			this.form.rp03 = res.data.data[0].RP03
			this.form.rp03name = res.data.data[0].RP03NAME
			this.form.rp05 = res.data.data[0].RP05
			this.form.rp05name = res.data.data[0].RP05NAME
			
			this.storeQuery.rp03name=this.form.rp03name
			this.storeQuery.brand=this.form.rp05name
		})
		
		
		// if (process.env.NODE_ENV === 'development') {
		// 	this.rowFormat()
		//  this.form.siteMemName += '-'+(new Date).getTime()
		// }
		
		// // 测试审批人员
		// this.form.siteApply1Code='hn021798'//一级审批人code
		// this.form.siteApply1Name='戴雄'//一级审批人name
		// // this.form.siteApply2Code='hn040255'//二级审批人code
		// // this.form.siteApply2Name='陈永杉'//二级审批人name
		// this.form.siteApply2Code='hn030637'//二级审批人code
		// this.form.siteApply2Name='葛鹏飞'//二级审批人name
		
	},
	mounted() {},
	methods: {
		rowFormat() {
			this.form={
					"id": "",
					"createBy": "HN026377",
					"updateBy": "HN026377",
					"siteCreateName": "苏文柔",
					"siteStatus": "SITE_STATUS_NEW",
					"siteAddName": "禅城",
					"siteScName": "环球",
					"siteTwName": "1106",
					"siteMemName": "测试aaa",
					"siteMemIdcard": "36252819890504001X",
					"siteLongitude": 113.264362,
					"siteLatitude": 23.12196,
					"siteAddress": "广东省广州市越秀区起义路公交站",
					"siteFrom": "其他店面",
					"siteDeptCode": "7285717632727868617",
					"siteDeptName": "青白江区汇通大道青龙建材城箭牌卫浴五金网点.高贯伟",
					// "siteApply1Code": "hn036967",
					// "siteApply1Name": "张巍",
					// "siteApply2Code": "hn031918",
					// "siteApply2Name": "李新鑫"
				}
		},
		checkCode200(res) {
			if (res.data.code == 200) {
				return true
			} else {
				uni.showToast({
					title: res.data.msg,
					duration: 2000,
					icon: 'error'
				})
				return false
			}
		},
		checkStatus00000(res) {
			if (res.data.status == '00000') {
				return true
			} else {
				uni.showToast({
					title: res.data.message,
					duration: 2000,
					icon: 'error'
				})
				return false
			}
		},
		pickerOpen() {
			this.pickerShow = true
		},
		pickerHide() {
			this.pickerShow = false
		},
		pickerConfirm(e) {
			e.value.forEach((item, index) => {
				this.form['g' + (index + 1) + 'Salesarea'] = item.name
			})
			this.pickerHide()
		},
		popupShow(e) {
			this.storeQuery.pageNum = 1
			this.storeList = []
			this.storeHasMore =  true
			this.getXdStoreList()
			this.popShow = true
		},
		popOpen(e) {
			// this.popShow = true
		},
		popClose(e) {
			this.popShow = false
		},
		// 滚动分页
		scrolltolower() {
			this.getXdStoreList()
		},
		// 选择店面列表接口
		getXdStoreList() {
			if(!this.storeHasMore) return
			uni.showLoading({ title: '加载中...' })
			xdStoreList(this.storeQuery, res => {
				if(!this.checkCode200(res)) return
				uni.hideLoading()
				
				this.storeList = this.storeList.concat(...res.data.rows)
				if(this.storeList.length >= res.data.total){
					this.storeHasMore = false
				}
				this.storeQuery.pageNum += 1
				
			})
		},
		// 提交按钮
		clickSubmit() {
			this.goSubmit()
		},
		backDateTofront(backDate) {
			return dayjs(backDate ? backDate.time : undefined).format('YYYY-MM-DD HH:mm:ss')
		},
		// 提交数据 ( 新增 )
		goSubmit() {
			var that = this;
			// if (this.form.id) {
			// 	// 编辑
			// 	this.form.updateDate = this.backDateTofront(this.form.updateDate)
			// 	this.form.updateBy = this.memCode
			// } else {
			// 	// 新建
			// 	this.form.createBy = this.memCode
			// }

			// this.form.createDate = this.backDateTofront(this.form.createDate)

			this.form.id = this.preId
			this.form.createBy = this.memCode
			this.form.updateBy = this.memCode
			
			
			this.form.siteCreateName=CONFIG.user.name
			this.form.siteStatus="SITE_STATUS_NEW"
			
			
			if(this.form.siteAddName==''){
				return uni.showToast({
					title: '请输入路名',
					duration: 2000,
					icon: 'error'
				})
			}
			if(this.form.siteScName==''){
				return uni.showToast({
					title: '请输入市场名',
					duration: 2000,
					icon: 'error'
				})
			}
			if(this.form.siteTwName==''){
				return uni.showToast({
					title: '请输入摊位号',
					duration: 2000,
					icon: 'error'
				})
			}
			if(this.form.siteMemName==''){
				return uni.showToast({
					title: '请输入姓名',
					duration: 2000,
					icon: 'error'
				})
			}
			if(this.form.siteMemIdcard==''){
				return uni.showToast({
					title: '请输入身份证',
					duration: 2000,
					icon: 'error'
				})
			}
			if(!test.idCard(this.form.siteMemIdcard)){
				return uni.showToast({
					title: '请输入正确的身份证',
					duration: 4000,
					icon: 'error'
				})
			}
			if(this.form.siteLatitude==''){
				// 一并检查了  siteLongitude  siteAddress
				return uni.showToast({
					title: '请选择位置',
					duration: 2000,
					icon: 'error'
				})
			}
			// 拿货来源：选择其他门店，门店必选；选择直发，隐藏选择门店这一行
			if(this.form.siteFrom==''){
				return uni.showToast({
					title: '请选择拿货来源',
					duration: 2000,
					icon: 'error'
				})
			}else{
				if(this.form.siteFrom=='其他店面'){
					if(this.form.siteDeptName==''){
						return uni.showToast({
							title: '请选择店面',
							duration: 2000,
							icon: 'error'
						})
					}
				}
			}
			if(this.shopImgs.length==0){
				return uni.showToast({
					title: '请上传门头照片',
					duration: 2000,
					icon: 'error'
				})
			}
			if(this.sampleImgs.length==0){
				return uni.showToast({
					title: '请上传样品照片',
					duration: 2000,
					icon: 'error'
				})
			}
			// if(this.form.siteDeptName==''){
			// 	return uni.showToast({
			// 		title: '请选择店面',
			// 		duration: 2000,
			// 		icon: 'error'
			// 	})
			// }
			
			console.log(this.form, '=====')
			// ccc
			//return 
			
			
			uni.showLoading({ title: '提交中...' })
			addSite(this.form, res => {
				if (res.data.code == 200) {
					// uni.hideLoading()
					this.goBackReload()
					uni.showLoading({
						title: '提交成功',
						duration: 2000,
						success() {
							// uni.redirectTo({
							// 	url:'./index'
							// })
							// uni.navigateBack()
							that.goSiteSp()
						}
					})
				} else {
					uni.showToast({
						title: res.data.message,
						duration: 2000,
						icon: 'error'
					})
				}
			})
		},
		// 发起审批
		goSiteSp(){
			
			uni.showLoading({ title: '提交中...' })
			siteSp({
			  // "id": "",
			  "createBy": this.memCode,
			  "updateBy": this.memCode,
			  "spApplyReason": "建店申请",
			  "spSiteId": this.form.id,
			  "spType": "SITE_SPTYPE_ADD"
			}, res => {
				if (res.data.code == 200) {
					uni.hideLoading()
					this.goBackReload()
					uni.showLoading({
						title: '提交成功',
						duration: 2000,
						success() {
							uni.redirectTo({
								url:'./list'
							})
							// uni.navigateBack()
						}
					})
					
				} else {
					uni.showToast({
						title: res.data.message,
						duration: 2000,
						icon: 'error'
					})
				}
			})
		},
		goBackReload() {
			// #ifdef APP-NVUE
			const eventChannel = this.$scope.eventChannel // 兼容APP-NVUE
			// #endif
			// #ifndef APP-NVUE
			const eventChannel = this.getOpenerEventChannel()
			// #endif
			eventChannel.emit('isReload')
		},
		// 拿货来源 选择
		radioChange(e) {
			console.log(e, '=====')
			this.form.siteFrom = e
			
			if(this.form.siteFrom=='公司直发'){
				// 清楚 选择的 门店
				this.form.siteDeptCode = ''
				this.form.siteDeptName = ''
				this.showSelStore = false
			}else{
				this.showSelStore = true
			}
		},
		// 选择 店面
		selStore(row){
			this.form.siteDeptCode = row.id
			this.form.siteDeptName = row.storeName
			this.popClose()
		},
		getPreIdFn() {
			var that = this
			// 多文件上传: 新增记录提交前，获取预定的记录id, 提交时要提交此预定的记录id
			// 接口: /common/getId
			getPreId(
				{},
				res => {
					console.log('getPreId-success:', res)
					if (res && res.statusCode == 200) {
						const rs = res.data
						if (rs && rs.code == 200) {
							const data = rs.data
							if (data.id) {
								that.preId = data.id || ''
								console.log('preId:' + that.preId)
							}
						}
					}
				},
				e => {
					console.log('getPreId-err:', e)
				}
			)
		},
		// 选择一张图片
		chooseImg() {
			var that = this
			if (!that.preId) {
				return uni.showToast({
					title: '缺少预id，刷新后重新',
					duration: 2000,
					icon: 'error'
				})
			}
			uni.chooseImage({
				count: 1,
				success: res => {
					var filePath = res.tempFilePaths[0] || ''
					var imgFile = res.tempFiles[0] || null
					var option = {
						buName: 'xdImg',
						params: {
							sourcessId: that.preId,
							sourcessType: 'shopMangerIdentity'
							// sourcessType2:'',
						}
					}
					this.uploadOss(imgFile, filePath, 0, 1, option, data => {
						console.log(data, '=====')
						// 设置图片信息
						var that = this
						const obj = {
							sourcessId: that.preId, // 业务id (预约记录id)
							fileId: data.fileId, // 文件记录id，编辑更新、删除时要传，新增时不传
							fileName: data.fileName,
							url: data.url
						}
						that.identity.push(obj)
						// 获取身份信息
						this.getIdCardInfoData(data.url)
					})
				}
			})
		},
		// 选择多张图片
		chooseMulImg(sourcessType) {
			if (!sourcessType) return console.log('缺少 sourcessType 取消上传 =====')
			var that = this
			if (!that.preId) {
				return uni.showToast({
					title: '缺少预id，刷新后重新',
					duration: 2000,
					icon: 'error'
				})
			}
			uni.chooseImage({
				success: res => {
					let lenCount = res.tempFilePaths.length
					let option = {
						buName: 'xdImg',
						params: {
							sourcessId: that.preId,
							sourcessType: sourcessType
							// sourcessType2:'',
						}
					}
					// 遍历多图并上传
					res.tempFilePaths.forEach((item, index) => {
						let filePath = res.tempFilePaths[index] || ''
						let imgFile = res.tempFiles[index] || null

						this.uploadOss(imgFile, filePath, index, lenCount, option, data => {
							console.log(sourcessType, data, '=====')
							const obj = {
								sourcessId: that.preId, // 业务id (预约记录id)
								fileId: data.fileId, // 文件记录id，编辑更新、删除时要传，新增时不传
								fileName: data.fileName,
								url: data.url
							}
							if (sourcessType == 'shopMangerShopImgs') {
								that.shopImgs.push(obj)
							} else if (sourcessType == 'shopMangerSampleImgs') {
								that.sampleImgs.push(obj)
							}
						})
					})
				}
			})
		},
		// 上传图片和回调
		uploadOss(imgFile, filePath, fileIndex, fileCount, option, callBack) {
			var that = this
			if (!that.preId) {
				console.log('no preid')
				return
			}
			if (imgFile) {
				var index = fileIndex || 0 // 默认第一个
				var len = fileCount || 1 // 默认一个
				var buName = option.buName || 'xdImg' // 自定义上传接口路径
				var fileType = imgFile.type // 文件类型
				var params = {
					// id: '', // 文件记录id，编辑更新时要传，新增时不传
					sourcessId: that.preId, // 业务id (预约记录id)
					sourcessType: '巡店图片', // 业务类型、记录分类
					createBy: that.CONFIG.user.id, // 创建者(华耐工号)
					// createTime: currentTime, // 创建时间
					// file: imgFile, // 文件
					fileType: fileType, // 文件类型
					// updateBy: '', // 编辑者
					// updateTime: currentTime, // 编辑时间
					isActive: '是' // 是否有效
				}
				params = Object.assign(params, option.params)

				uni.showLoading({ title: '上传中', mask: true })
				that.showULineProgress = true
				const uploadTask = uni.uploadFile({
					url: that.CONFIG.api + '/common/upload/' + buName,
					file: imgFile,
					filePath: filePath,
					name: 'file',
					header: {
						Authorization: 'Bearer ' + (that.CONFIG.token || ''),
						lesseeid: that.CONFIG.lesseeid || ''
					},
					formData: params,
					success: uploadFileRes => {
						uni.hideLoading()
						that.showULineProgress = false
						that.currentProgress = 0
						if (uploadFileRes.statusCode == 200) {
							let data = uploadFileRes.data
							if (data && typeof data == 'string') {
								data = JSON.parse(data)
							}
							console.log(data)
							if (data.fileId && data.code == 200) {
								console.log('上传成功-----：', data.msg)
								callBack && callBack(data)
							} else {
								console.log('上传失败-----：', data.msg)
								that.$refs.uToast.show({
									title: data.msg || '上传失败',
									type: 'error', // primary / success / error / warning / info
									duration: 8000
								})
							}
						} else {
							console.log('上传完:', uploadFileRes)
						}
					}
				})
				uploadTask.onProgressUpdate(res => {
					that.currentProgress = res.progress
					console.log('上传进度' + res.progress)
					console.log('已经上传的数据长度' + res.totalBytesSent)
					console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend)
				})
			}
		},
		// 在地图上选点
		chooseLocation() {
			uni.chooseLocation({
				latitude: this.form.siteLatitude,
				longitude: this.form.siteLongitude,
				success: res => {
					// console.log('位置名称：' + res.name)
					// console.log('详细地址：' + res.address)
					// console.log('纬度：' + res.latitude)
					// console.log('经度：' + res.longitude)
					this.form.siteAddress = res.address
					this.form.siteLatitude = res.latitude
					this.form.siteLongitude = res.longitude
				}
			})
		},
		// 删除图片
		deleteImg(typeName, index, image) {
			// 如果image里有code_row 代表是 已经存到库里的信息 不做真删处理 只是记录一下 图片code和该条code 等点击 “上传” 时候再跟进这两个数组做真删处理
			console.log(typeName, index, image, '=====')
			if (typeName == 'shopImgs') {
				this[typeName].splice(index,1)
			} else if (typeName == 'sampleImgs') {
				this[typeName].splice(index,1)
			}
		},
		// 图片预览
		imgPreview(idx) {
			const that = this
			const list = []
			that.myImageList.forEach((item) => {
				list.push(item.url)
			})
			console.log(list)
			// 预览图片
			uni.previewImage({
				current: idx, // uni有一个自带的previewImage方法，是预览图片的效果，但current属性在h5下传入Number不兼容，所以使用数组的方式传入。
				urls: list
			})
		},
		// 扫描身份证信息
		getIdCardInfoData(url){
			let imgUrl = url || (this.identity[0]&&this.identity[0].url) || ''
			if(!imgUrl) {
				return uni.showToast({
					title: '缺少身份图片',
					duration: 2000,
					icon: 'error'
				})
			}
			uni.showLoading({ title: '扫描中...' })
			getIdCardInfo({
			  "url": imgUrl,
			}, res => {
				if (res.data.code == 200) {
					if(res.data.data){
						this.cardInfo = res.data.data
						uni.hideLoading()
						uni.showModal({
							title: '扫描成功',
							content: '扫描成功：'+this.cardInfo.name+' - '+this.cardInfo.idNumber+"，是否填入？",
							success:  (res) => {
								if (res.confirm) {
									this.form.siteMemName=this.cardInfo.name
									this.form.siteMemIdcard=this.cardInfo.idNumber
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
					}else{
						uni.showToast({
							title: '扫描失败，请检查身份图片正确后重新上传',
							duration: 5000,
							icon: 'error'
						})
					}
				} else {
					uni.showToast({
						title: res.data.message,
						duration: 2000,
						icon: 'error'
					})
				}
			})
		},
		// 获取导购信息
		getMemberInfoByMemCode(memcode, call){
			MemberInfoByMemCode({memcode}, res=>{
				if(res.data.status=="00000"){
					if(call){
						call(res)
					}
				}else{
					this.$refs.uToast.show({
						title: '获取用户信息失败',
						type: 'error',
						duration: 3000
					});
				}
			})
		},
	}
}
</script>

<style lang="scss" scoped>
.flex1 {
	flex: 1;
}
.iW120 {
	width: 120rpx;
}
.itr {
	text-align: right !important;
}
.page-container {
	// padding-top: 15px;
	// padding-bottom:20px;
	font-family: PingFang SC;
	color: #333333;
	position: relative;
	font-weight: 400;

	height: 100%;
	box-sizing: border-box;
	background: #ffffff;

	.input-placeholder {
		color: #999;
	}

	.noInfo{
		padding:20rpx;
		text-align: center;
	}
	
	.goAddBtnBox {
		background-color: #fff;
		width: 100%;
		padding: 25rpx 0;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 3;
	}
	.goAddBtn {
		margin: 0 31rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #ffffff;
		line-height: 90rpx;
		text-align: center;

		background: #007aff;
		border-radius: 10px;
	}

	.cap {
		line-height: 76rpx;
		background: #f4f4f4;
		font-size: 30rpx;
		padding: 0 23rpx;
	}

	.card {
		border-radius: 10rpx;
		background-color: #fff;
		margin: 0 0 12px;
		overflow: hidden;

		&.cardPop {
			width: 100%;
			box-sizing: content-box;
			padding-top: 0;
			border-radius: 0;
			.content {
				padding: 0;
			}
		}
	}

	.scroll-y {
		margin-top: 5px;
		max-height: 400px;
		box-sizing: border-box;
	}
	.modalBox {
		padding: 20rpx;

		.modalBoxTit {
			padding: 30rpx 0;
			display: flex;
			align-items: center;
			justify-content: center;
			.icon {
				width: 36rpx;
				height: 36rpx;
				margin-right: 18rpx;
			}
		}
	}
	.popBox {
		padding: 20rpx;
		// /deep/.u-popup__content{
		// 	margin-top: -50px;
		// 	border-radius: 10px;
		// 	padding:10px 15px;
		// 	width: 90%;
		// 	box-sizing: border-box;
		// }
	}

	.inputBox {
		display: flex;
		margin: 0 31rpx;
		line-height: 70rpx;
		border-bottom: 1px solid #e5e5e5;
		box-sizing: border-box;
		padding: 20rpx 0;
		align-items: center;

		&:last-child {
			border-bottom: 0px solid #e5e5e5;
		}

		.need {
			font-size: 28rpx;
			font-weight: 400;
			color: #ff0000;
		}
		.tit {
			font-size: 30rpx;
			font-weight: 400;
			color: #333333;
		}
		.input {
			flex: 1;
			text-align: right;
			color: #333333;
			font-weight: bold;
			font-size: 30rpx;
			position: relative;
			line-height: 1.2;
		}
		.inputCover {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
		}
		.inpCenter {
			text-align: center;

			&:last-child {
				margin-right: 0;
			}
		}
		.inpLine {
			margin: 0 20rpx;
			color: #545454;

			&.lineCol1 {
				color: #c9c9c9;
			}
		}
		.storeName{
			margin:0 20rpx;
		}

		// 内容
		&.comListBox {
			display: block;
			// border-bottom: 0px solid #E5E5E5;
			margin-right: 0;
		}

		// 弹窗 审批流程
		&.popInpBox {
			display: block;
			padding-bottom: 40rpx;
			& > .tit {
				text-align: center;
				padding: 20rpx 0;
			}
		}
		&.modalInpBox {
			align-items: flex-start;

			.modalInpTit {
				width: 120rpx;
				font-size: 26rpx;
				font-weight: 400;
				color: #333333;
				margin-top: 20rpx;
			}
		}

		// 申请撤销
		$applyItem_mr: 130rpx;
		$applyItem_w: 85rpx;
		.applyItem {
			display: inline-block;
			position: relative;
			text-align: center;
			padding: 0 16rpx;
			margin-bottom: 20rpx;
			margin-right: $applyItem_mr;
			&:last-child {
				margin-right: 0rpx;
			}

			.auditor {
				width: $applyItem_w;
				height: $applyItem_w;
				font-size: 24rpx;
				font-weight: 400;
				color: #666666;
			}
			.tit {
				font-size: 26rpx;
				font-weight: 400;
				color: #333333;
			}

			.line {
				position: absolute;
				top: 44rpx;
				left: 100%;

				width: $applyItem_mr;
				height: 2rpx;
				background: #639edf;
			}
			&:last-child .line {
				display: none;
			}
		}

		// 内容列表框
		.comList {
			margin-top: 10rpx;
			display: flex;
			width: 100%;
			// justify-content: space-between;
			flex-wrap: wrap;

			// 图片列表
			.imgItem {
				width: 150rpx;
				border-radius: 6px;
				margin: 0 30rpx 20rpx 0;
				position: relative;

				.img {
					width: 150rpx;
					height: 150rpx;
					border-radius: 6px;
				}

				.picBoxRemove {
					position: absolute;
					right: -12px;
					top: -13px;
					font-size: 24px;
					color: #fd7a3f;
				}
			}

			// 审批流程
			.reviewItem {
				width: 100%;
				position: relative;
				padding-left: 46rpx;
				.point {
					position: absolute;
					top: 16rpx;
					left: 14rpx;
					z-index: 2;

					width: 14rpx;
					height: 14rpx;
					background: #007aff;
					border-radius: 50%;
				}
				.line {
					position: absolute;
					top: 18rpx;
					left: 20rpx;

					width: 2rpx;
					height: 100%;
					background: #e7e7e7;
				}
				&:last-child .line {
					display: none;
				}
				.tit {
					width: 100%;
					font-size: 26rpx;
					font-weight: bold;
					color: #333333;
				}
				.time {
					width: 100%;
					font-size: 24rpx;
					font-weight: 400;
					color: #666666;
				}
			}
		}

		.icon-arrow-b {
			margin-left: 20rpx;
			transform: scale(0.6, 0.3);
		}

		.icon {
			width: 122rpx;
			line-height: 46rpx;
			border-radius: 4px;

			font-size: 24rpx;
			font-weight: 400;
			color: #ffffff;
			text-align: center;

			margin-left: 17rpx;

			&.iconBg1 {
				background: #007aff;
			}
		}
	}
	
	
	.client-list{
		margin:0 20rpx 20rpx;
		.client-item.disabled{
			opacity: .5;
		}
		.client-item.on{
			.block{
				background-color: #2979ff;
				color:#fff;
			}
		}
		.client-item{
			margin-bottom: 20rpx;
			
			position: relative;
			display: flex;
			align-items: center;
			.border1{
				border-left:solid 5px #00B377;
			}
			.border2{
				border-left:solid 5px #FF8B4C;
			}
			.block{
				width: 100%;
				padding:20rpx;
				background-color: #f7f7f7;
				border-radius: 10rpx;
				overflow: hidden;
				display: flex;
				align-items: center;
			}
			.info{
				flex:1;
				font-weight: bold;
				.name{
					font-size: 16px;
					line-height: 18px;
				}
				.phone{width: 195px;
					font-size: 14px;
					margin-left: 15px;
				}
				.address{
					margin-top: 6px;
					font-size: 13px;
					font-weight: normal;
				}
			}
			
			.arrow{
				font-size: 15px;
				font-weight: 400;
				display: flex;
				width: 12px;
				text-align: center;
			}
			
			.trash_W{
				width: 32px;
			}
			.trash{
				font-size: 15px;
				font-weight: 400;
				display: flex;
				justify-content: center;
				margin-left: 10px;
			}
			.trash_bg{
				position: absolute;
				top:0;
				right:0;
				bottom: 0;
				background-color: #f7f7f7;
				border-radius: 5px;
			}
		}
	}
	
	.unClient-list{
		.summary{
			font-size: 14px;
			line-height: 24px;
			padding:8px 0;
			
			span{
				font-size: 12px;
				font-weight: 400;
				color: #FF392A;
			}
		}
	}
	.search-box{
		height: 28px;
		line-height: 28px;
		margin-bottom: 15px;
		
		/deep/.u-search__content__input{
			height:28px !important;
			line-height: 28px;
		}
		/deep/.u-search__action--active{
			width: auto;
			margin-left: 5px;
			line-height: inherit;
			padding: 0 18px;
			background-color: $uni-color-primary;
			border-radius: 18px;
			text-align: center;
			color:#fff;
		}
	}
	
	.scroll-y{
		margin-top:5px;
		max-height:800rpx;
		height:800rpx;
		box-sizing: border-box;
	}
	.popBox{
		// position: relative;
		// z-index: 2;
		
		// /deep/.u-popup__content{
		// 	margin-top: -50px;
		// 	border-radius: 10px;
		// 	padding:10px 15px;
		// 	width: 90%;
		// 	box-sizing: border-box;
		// }

		.popCap{
			font-size: 40rpx;
			font-weight: 400;
			color: #333333;
			text-align: center;
			padding: 10rpx;
			margin-bottom:10rpx;
		}
	}
	
	.popClose{
		position: absolute;
		width: 27px;
		height: 27px;
		bottom: -50px;
		left:50%;
		margin-left:-18px
	}
}
</style>
